function implode (glue, pieces) {
  // http://kevin.vanzonneveld.net
  // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
  // +   improved by: Waldo Malqui Silva
  // +   improved by: Itsacon (http://www.itsacon.net/)
  // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
  // *     example 1: implode(' ', ['Kevin', 'van', 'Zonneveld']);
  // *     returns 1: 'Kevin van Zonneveld'
  // *     example 2: implode(' ', {first:'Kevin', last: 'van Zonneveld'});
  // *     returns 2: 'Kevin van Zonneveld'
  var i = '',
    retVal = '',
    tGlue = '';
  if (arguments.length === 1) {
    pieces = glue;
    glue = '';
  }
  if (typeof(pieces) === 'object') {
    if (Object.prototype.toString.call(pieces) === '[object Array]') {
      return pieces.join(glue);
    }
    for (i in pieces) {
      retVal += tGlue + pieces[i];
      tGlue = glue;
    }
    return retVal;
  }
  return pieces;
}
var Lib = {
    getParameterByName : function (name)
    {
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regexS = "[\\?&]" + name + "=([^&#]*)";
        var regex = new RegExp(regexS);
        var results = regex.exec(window.location.search);
        if(results == null) {
            return "";
        } else {
        return decodeURIComponent(results[1].replace(/\+/g, " "));
        }
    },
    getCookie : function (c_name)
    {
        if (document.cookie.length>0) {
            c_start=document.cookie.indexOf(c_name + "=");
            if(c_start!=-1) {
                c_start=c_start + c_name.length+1;
                c_end=document.cookie.indexOf(";",c_start);
                if (c_end==-1) {
                    c_end=document.cookie.length;
                }
                return unescape(document.cookie.substring(c_start,c_end));
            }
        }
        return '';
    },
    setCookie : function (name, value, expiredays, path)
    {
        var exdate=new Date();
        exdate.setDate(exdate.getDate()+expiredays);
        document.cookie = name + '=' + decodeURIComponent(value) +
        ((expiredays==null) ? '' : ';expires='+exdate.toGMTString()) +
        ((path==null) ? '' : ';path='+path);
    },
    inArray : function (stringToSearch, arrayToSearch)
    {
        for (s = 0; s < arrayToSearch.length; s++) {
                thisEntry = arrayToSearch[s].toString();
                if (thisEntry == stringToSearch) {
                        return true;
                }
        }
        return false;
    },
    http : function (method, uri, params, callback, is_async)
    {
        if(is_async == null) {
            is_async = false;
        }
        if(params == null) {
            params = '';
        }
        if(callback == null) {
            casllback = function(){};
        }
        var xmlhttp;
        if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        } else {// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function() {
            if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                callback(xmlhttp);
            }
        }
        if(method.toUpperCase() == 'GET') {console.log(is_async);
            xmlhttp.open(method.toUpperCase(), uri + implode(params), is_async);
            xmlhttp.send();
        } else {
            xmlhttp.open(method.toUpperCase(), uri, is_async);
            xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
            xmlhttp.send(); //todo

        }
        return true;
    },
}
